package com.travelsmart.client.apresentacao.view;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DecoratedStackPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.travelsmart.client.apresentacao.controller.CommandController;
import com.travelsmart.client.apresentacao.i18n.I18nMessages;
import com.travelsmart.client.apresentacao.view.subview.ViewImagensHotel;
import com.travelsmart.client.apresentacao.view.subview.ViewInfoDetalhesHotel;
import com.travelsmart.client.apresentacao.view.subview.ViewListQuarto;
import com.travelsmart.client.apresentacao.view.subview.ViewMapHotel;
import com.travelsmart.client.apresentacao.widget.FormDialogBox;
import com.travelsmart.client.bean.to.QuartoTO;


//# EXERC. 4 //TODO Exercicio 4
public class ViewDadosHotel extends BaseView {

	private final DecoratedStackPanel panelViewDadosHotel = new DecoratedStackPanel();
	private final ViewImagensHotel viewImagensHotel = new ViewImagensHotel();
	private ViewListQuarto viewListQuarto = null;
	private final ViewMapHotel viewMapHotel = new ViewMapHotel();
	private final ViewInfoDetalhesHotel viewInfoDetalhesHotel = new ViewInfoDetalhesHotel();

	public ViewDadosHotel(CommandController<QuartoTO> handler) {
		super(new HTML(I18nMessages.INSTANCE.dados_hotel()));
		viewListQuarto = new ViewListQuarto(handler);
		initWidget(panelViewDadosHotel);
	}

	public void exec() {
		panelViewDadosHotel.clear();
		final VerticalPanel vPanelViewDadosHotel = new VerticalPanel();
		vPanelViewDadosHotel.add(viewInfoDetalhesHotel);
		vPanelViewDadosHotel.add(new Button("<span id='button_hotel_mapa'>"
				+ I18nMessages.INSTANCE.mapa_hotel() + "</span>",
				new ClickHandler() {
					@Override
					public void onClick(ClickEvent event) {
						final FormDialogBox dialogBox = new FormDialogBox(null,
								I18nMessages.INSTANCE.mapa_hotel(),
								viewMapHotel);
						dialogBox.show();
					}
				}));
		panelViewDadosHotel.add(vPanelViewDadosHotel,
				"<span id='hotel_informacao'>"
						+ I18nMessages.INSTANCE.informacao() + "</span>", true);
		panelViewDadosHotel.add(viewImagensHotel, "<span id='hotel_imagens'>"
				+ I18nMessages.INSTANCE.imagens_hotel() + "</span>", true);
		panelViewDadosHotel.add(viewListQuarto, "<span id='hotel_quartos'>"
				+ I18nMessages.INSTANCE.quartos() + "</span>", true);
		panelViewDadosHotel.showStack(0);
	}

	public ViewImagensHotel getViewImagensHotel() {
		return viewImagensHotel;
	}

	public ViewListQuarto getViewListQuarto() {
		return viewListQuarto;
	}

	public ViewMapHotel getViewMapHotel() {
		return viewMapHotel;
	}

	public ViewInfoDetalhesHotel getViewInfoDetalhesHotel() {
		return viewInfoDetalhesHotel;
	}

}
